<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=0">

		<title>地址管理</title>

		<link href="/Public/person/AmazeUI-2.4.2/assets/css/admin.css" rel="stylesheet" type="text/css">
		<link href="/Public/person/AmazeUI-2.4.2/assets/css/amazeui.css" rel="stylesheet" type="text/css">

		<link href="/Public/person/css/personal.css" rel="stylesheet" type="text/css">
		<link href="/Public/person/css/addstyle.css" rel="stylesheet" type="text/css">
		
		<script src="/Public/person/AmazeUI-2.4.2/assets/js/jquery.min.js" ></script>
		<script src="/Public/person/AmazeUI-2.4.2/assets/js/amazeui.js"></script>


		<!-- Theme CSS
		============================================ -->
   		<link href="/Public/mobilemall/css/themecss/so_megamenu.css" rel="stylesheet">
		<link id="color_scheme" href="/Public/mobilemall/css/theme.css" rel="stylesheet">

		 <!-- Libs CSS
		============================================ -->
	   	<link rel="stylesheet" href="/Public/mobilemall/css/bootstrap/css/bootstrap.min.css">
		<link href="/Public/mobilemall/css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
		<link href="/Public/mobilemall/js/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
	   	<link href="/Public/mobilemall/js/owl-carousel/owl.carousel.css" rel="stylesheet">
		<link href="/Public/mobilemall/css/themecss/lib.css" rel="stylesheet">
		<link href="/Public/mobilemall/js/jquery-ui/jquery-ui.min.css" rel="stylesheet">	

	</head>

	<body style="background: #F5F8FA">
		<!--头 -->
		
		<include file="./Application/Home/View/Share/header1.html"/>
		
		<b class="line"></b>

		<div class="center">
			<div class="col-main">
				<div class="main-wrap">

					<div class="user-address">
						<!--标题 -->
						<div class="am-cf am-padding">
							<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">地址管理</strong> / <small>Address&nbsp;list</small></div>
						</div>
						<hr/>
						<ul class="am-avg-sm-1 am-avg-md-3 am-thumbnails">

							<volist name="useraddresslist" id="vo">
							<eq name="vo.isdefault" value="1">
							<li class="user-addresslist defaultAddr" cid="{$vo.id}">
								<span class="new-option-r"><i class="am-icon-check-circle"></i>默认地址</span>
								<p class="new-tit new-p-re">
									<span class="new-txt">{$vo.consignor}</span>
									<span class="new-txt-rd2">{$vo.telephone}</span>
								</p>
								<div class="new-mu_l2a new-p-re">
									<p class="new-mu_l2cw">
										<span class="title">地址：</span>
										<span class="province">{$vo.province}</span>
										<span class="city">{$vo.city}</span>
										<span class="dist">{$vo.district}</span>
										<span class="street">{$vo.detaddress}</span></p>
								</div>
								<div class="new-addr-btn">
									<a href="/Home/Person/editaddress?addressid={$vo.id}"><i class="am-icon-edit"></i>编辑</a>
									<span class="new-addr-bar">|</span>
									<a href="" onclick="deladdress(this);"><i class="am-icon-trash"></i>删除</a>
								</div>
							</li>
							<else/>
							<li class="user-addresslist" cid="{$vo.id}">
								<span class="new-option-r"><i class="am-icon-check-circle"></i>设为默认</span>
								<p class="new-tit new-p-re">
									<span class="new-txt">{$vo.consignor}</span>
									<span class="new-txt-rd2">{$vo.telephone}</span>
								</p>
								<div class="new-mu_l2a new-p-re">
									<p class="new-mu_l2cw">
										<span class="title">地址：</span>
										<span class="province">{$vo.province}</span>
										<span class="city">{$vo.city}</span>
										<span class="dist">{$vo.district}</span>
										<span class="street">{$vo.detaddress}</span></p>
								</div>
								<div class="new-addr-btn">
									<a href="/Home/Person/editaddress?addressid={$vo.id}"><i class="am-icon-edit"></i>编辑</a>
									<span class="new-addr-bar">|</span>
									<a href="" onclick="deladdress(this);"><i class="am-icon-trash"></i>删除</a>
								</div>
							</li>
							</eq>
							
							</volist>

							
							
						</ul>
						<div class="clear"></div>
						<a class="new-abtn-type" >添加新地址</a>
						<!--例子-->
						
						<div class="am-modal am-modal-no-btn" id="doc-modal-1">

							<div class="add-dress">

								<!--标题 -->
								<div class="am-cf am-padding">
									<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">新增地址</strong> / <small>Add&nbsp;address</small></div>
								</div>
								<hr/>

								<div class="am-u-md-12 am-u-lg-8" style="margin-top: 20px;">
									<form class="am-form am-form-horizontal" method="post" action="/Home/Person/addaddress">

										<div class="am-form-group">
											<label for="user-name" class="am-form-label">收货人</label>
											<div class="am-form-content">
												<input type="text" id="user-name" placeholder="收货人" name="consignor">
											</div>
										</div>

										<div class="am-form-group">
											<label for="user-phone" class="am-form-label">手机号码</label>
											<div class="am-form-content">
												<input id="user-phone" placeholder="手机号必填" type="text" name="telephone">
											</div>
										</div>
										<div class="am-form-group">
											<label for="user-address" class="am-form-label">所在地</label>
											<div class="am-form-content address">
												<select data-am-selected name="province" id="selprovince" onchange="changecity(this);">
													<option value="0">选择省份</option> 
													 <volist name="provincelist" id="vo" empty="暂时没有数据">
                                                                    								<option value="{$vo.id}">{$vo.provincename}</option>            
                                                                    								</volist>
												</select>
												<select data-am-selected name="city" id="selcity" onchange="changedistrict(this)">
													<option value="0">选择城市</option>
												</select>
												<select data-am-selected name="district" id="seldistrict">
													<option value="0">选择县区</option>
													
												</select>
											</div>
										</div>

										<div class="am-form-group">
											<label for="user-intro" class="am-form-label">详细地址</label>
											<div class="am-form-content">
												<textarea class="" rows="3" id="user-intro" placeholder="输入详细地址" name="detaddress"></textarea>
												<small>100字以内写出你的详细地址...</small>
											</div>
										</div>

										<div class="am-form-group">
											<div class="am-u-sm-9 am-u-sm-push-3">
												<button type="submit" class="am-btn am-btn-danger tpl-btn-bg-color-success ">添加</button>
												
											</div>
										</div>
									</form>
								</div>

							</div>

						</div>
						
					</div>

					<script type="text/javascript">
						$(document).ready(function() {	
							//改变默认地址						
							$(".new-option-r").click(function() {
								$(this).parent('.user-addresslist').addClass("defaultAddr").siblings().removeClass("defaultAddr");
								$(this).html("<i class='am-icon-check-circle'></i>默认地址").parent('.user-addresslist').siblings().children("span.new-option-r").html("<i class='am-icon-check-circle'></i>设为默认");
								var addressid = $(this).parents('.user-addresslist').attr('cid'); 
								//alert(addressid);
								$.post('/API/Address/changedefault',{"addressid":addressid},function(res){
								                  	
							                         
						            		});
							});
							//删除地址

							var $ww = $(window).width();
							if($ww>640) {
								$("#doc-modal-1").removeClass("am-modal am-modal-no-btn")
							};


							


							
						});


					</script>

					<div class="clear"></div>

				</div>
				<!--底部-->
				<!-- <div class="footer">
					<div class="footer-hd">
						<p>
							<a href="#">恒望科技</a>
							<b>|</b>
							<a href="#">商城首页</a>
							<b>|</b>
							<a href="#">支付宝</a>
							<b>|</b>
							<a href="#">物流</a>
						</p>
					</div>
					<div class="footer-bd">
						<p>
							<a href="#">关于恒望</a>
							<a href="#">合作伙伴</a>
							<a href="#">联系我们</a>
							<a href="#">网站地图</a>
							<em>© 2015-2025 Hengwang.com 版权所有</em>
						</p>
					</div>
				</div> -->
			</div>

			<aside class="menu">
				<ul>
					<li class="person ">
						<a href="/Home/Person/index"><i class="am-icon-user"></i>个人中心</a>
					</li>
					<li class="person">
						<a href="#"><i class="am-icon-newspaper-o"></i>个人资料</a>
						<ul>
							<li> <a href="/Home/Person/information">个人信息</a></li>
							<li > <a href="/Home/Person/safety">安全设置</a></li>
							<li class="active"> <a href="/Home/Person/address">收货地址</a></li>
						</ul>
					</li>
					<li class="person">
						<a href="#"><i class="am-icon-balance-scale"></i>我的交易</a>
						<ul>
							<li><a href="/Home/Person/order">订单管理</a></li>

						</ul>
					</li>
					

					<li class="person">
						<a href="#"><i class="am-icon-tags"></i>我的小窝</a>
						<ul>
							<li> <a href="/Home/Person/collection">收藏</a></li>
							<li> <a href="/Home/Person/foot">足迹</a></li>
							<li> <a href="/Home/Person/comment">评价</a></li>
							<!-- <li> <a href="news.html">消息</a></li> -->
						</ul>
					</li>

				</ul>

			</aside>
		</div>
		<!--底部-->
		<include file="./Application/Home/View/Share/footer.html"/>
<!-- Placed at the end of the document so the pages load faster -->

<script type="text/javascript" src="/Public/mobilemall/js/jquery-2.2.4.min.js"></script>

<script type="text/javascript" src="/Public/mobilemall/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/owl-carousel/owl.carousel.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/themejs/libs.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/unveil/jquery.unveil.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/countdown/jquery.countdown.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/dcjqaccordion/jquery.dcjqaccordion.2.8.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/datetimepicker/moment.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/Public/mobilemall/js/jquery-ui/jquery-ui.min.js"></script>

<!-- Theme files
============================================ -->
<script type="text/javascript" src="/Public/mobilemall/js/themejs/application.js"></script>

<script  type="text/javascript">
 //改变显示的城市列表
             function changecity(obj){
          		var a=$(obj).val();
                         if (a!=0) {
                                       $.ajax({
                                                    type: "POST",
                                                    url: "{:u('/API/Address/loadcity')}",
                                                    data: {"provinceid":a},
                                                    dataType: "json",
                                                    success: function (res) {   
                                                                 $("#selcity").html("<option value=''>请选择城市</option>");
                                                                 $.each(res.data, function(i, item) {
                                                                             $("#selcity").append("<option value='" + item.id + "'>" + item.cityname + "</option>");
                                                                  });
                                                    },  
                                                    eror: function (res) {   
                                                                 alert("请求超时!")    
                                                    }       
                                       });
                         }
             }
//改变显示的县区列表
	function changedistrict(obj){
		var b=$(obj).val();
		if(b!=0){
			$.ajax({
                                                    type: "POST",
                                                    url: "{:u('/API/Address/loaddistrict')}",
                                                    data: {"cityid":b},
                                                    dataType: "json",
                                                    success: function (res) {   
                                                                 $("#seldistrict").html("<option value=''>请选择县区</option>");
                                                                 $.each(res.data, function(i, item) {
                                                                             $("#seldistrict").append("<option value='" + item.id + "'>" + item.districtname + "</option>");
                                                                  });
                                                    },  
                                                    eror: function (res) {   
                                                                 alert("请求超时!")    
                                                    }       
                                       });
		}
	}
	//确认是否删除地址
	function deladdress(obj){
                          if(confirm("确定要删除此收货地址吗？")){
                          	var addressid = $(obj).parents(".user-addresslist").attr('cid');
                          	$.post("/API/Address/deladdress",{"addressid":addressid},function(res){
                          		alert(res.data);
                          	});	
                          }
             }	
</script>

	</body>

</html>